let graph = new joint.dia.Graph;

//声明画布
let paper = new joint.dia.Paper({
    el:$("#paper"),
    width:800,
    height:600,
    gridSize:10,
    drawGrid:true,
    model:graph
});

//获取画布的基础信息
//paper.options

//声明top节点
let topNode = new joint.shapes.standard.Rectangle({
    position:{x:350,y:30},
    size:{width: 100,height: 30},
    attrs:{
        body:{fill:'lightgreen'},
        label:{text:'开始',fill: 'white'}
    }
});

//声明top子节点
let childNode = new joint.shapes.standard.Rectangle({
    position: {x:250,y:160},
    size: {width:100,height:30},
    attrs: {
        body: {fill:'lightgreen'},
        label: {text:'创建用户',fill:'white'}
    }
});

let childNode1 = new joint.shapes.standard.Rectangle({
    position:{x:450,y:160},
    size:{width:100,height:30},
    attrs:{
        body:{fill:"lightgreen"},
        label:{text:"游客浏览",fill:"white"}
    }
});

let link = new joint.shapes.standard.Link({
    source:{id:topNode.id},
    target:{id:childNode.id}
});

let link2 = new joint.shapes.standard.Link({
    source:{id:topNode.id},
    target:{id:childNode1.id}
});

topNode.embed(childNode)
topNode.embed(childNode1)

//渲染
graph.addCells([topNode,childNode,childNode1,link,link2]);